package com.ss.android.article.base.feature.feed.activity;

import android.content.Context;

import com.ss.android.article.base.feature.model.Article;
import com.ss.android.article.base.feature.model.CellRef;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.model.BaseArticle;
import org.json.JSONObject;

public final class UgcEventHelper {
    CellRef mCellRef;
    private Context mContext;
    private String mCategoryId;
    private long mConcernId;
    private int mReferType;

    public UgcEventHelper(Context context, CellRef cellRef, String categoryId, long concernId, int referType) {
        this.mCellRef = cellRef;
        this.mContext = context;
        this.mCategoryId = categoryId;
        this.mConcernId = concernId;
        this.mReferType = referType;
    }

    public final void reportEvent(String event) {
        long v4 = 0;
        String v2 = "new_list";
        if(this.mCellRef != null && !android.support.design.a.isTextEmpty(v2) && !android.support.design.a.isTextEmpty(event)) {
            Article article = this.mCellRef.article;
            if(article != null) {
                int v0 = 0;
                if(this.mCellRef.cellType == 32) {
                    v0 = 33;
                }
                else if(this.mCellRef.cellType == 0) {
                    v0 = 1;
                }

                if(this.mCellRef != null && this.mCellRef.article != null) {
                    v4 = this.mCellRef.article.groupId;
                }

                MobClickCombiner.onEvent(this.mContext, v2, event, v4, this.mCellRef.adId, this.a(article, this.mReferType, v0));
            }
        }
    }

    private JSONObject a(BaseArticle arg5, int refer, int gtype) {
        JSONObject jo;
        if(arg5 == null) {
            jo = null;
            return jo;
        }

        jo = new JSONObject();
        try {
            jo.put("category_id", this.mCategoryId);
            jo.put("concern_id", this.mConcernId);
            jo.put("refer", refer);
            jo.put("item_id", arg5.itemId);
            jo.put("aggr_type", arg5.aggrType);
            jo.put("gtype", gtype);
        }
        catch(Exception v1) {
        }

        return jo;
    }
}

